/**
 * Created by 白雨浓 on 2018/1/16 18:40.
 */

export const template=`package <%= packageName %>.convert;

import <%= packageName %>.#b.<%= clsName %>#B;
import <%= packageName %>.convert.base.BaseConvert;
import <%= packageName %>.#e.<%= clsName %>#E;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

/**
 * <%= packageName %>.convert
 *
 * @author 白雨浓
 * date: <%= date %>
 * content: 转换
 */
public class <%= clsName %>Convert extends BaseConvert {

    public static <%= clsName %>#B to#B(<%= clsName %>#E #e) {
        if (#e == null){
            return null;
        }
        return mapper.map(#e, <%= clsName %>#B.class);
    }

    public static <%= clsName %>#E to#E(<%= clsName %>#B #b) {
        if (#b == null){
            return null;
        }
        return mapper.map(#b, <%= clsName %>#E.class);
    }

    public static List<<%= clsName %>#B> to#BList(List<<%= clsName %>#E> list) {
        List<<%= clsName %>#B> #bList = new ArrayList<>(list.size());
        list.forEach(#e -> #bList.add(to#B(#e)));
        return #bList;
    }

    public static List<<%= clsName %>#B> to#BList(List<<%= clsName %>#E> list, Consumer<<%= clsName %>#E> consumer) {
        List<<%= clsName %>#B> #bList = new ArrayList<>(list.size());
        list.forEach(#e -> {
            consumer.accept(#e);
            #bList.add(to#B(#e));
        });
        return #bList;
    }

    public static List<<%= clsName %>#E> to#EList(List<<%= clsName %>#B> list) {
        List<<%= clsName %>#E> #eList = new ArrayList<>(list.size());
        list.forEach(#b -> #eList.add(to#E(#b)));
        return #eList;
    }

    public static List<<%= clsName %>#E> to#EList(List<<%= clsName %>#B> list, Consumer<<%= clsName %>#B> consumer) {
        List<<%= clsName %>#E> #eList = new ArrayList<>(list.size());
        list.forEach(#b -> {
            consumer.accept(#b);
            #eList.add(to#E(#b));
        });
        return #eList;
    }
}`;